package com.dwsoft.word;

import com.dwsoft.xml.XHeading1;
import com.dwsoft.xml.XmlNode;
import org.springframework.stereotype.Component;
import word.w2004.Document2004;
import word.w2004.elements.Heading1;

import java.io.IOException;
import java.util.List;

/**
 * @author sqw
 * @version 1.0
 * @description xml一级实例化word一级标题
 * @ClassName Heading1Strategy
 * @Date 2020/8/5
 * @since jdk1.8
 */
@Component("heading1")
public class WHeading1 extends WElement<XHeading1> {

    @Override
    public void instance(XHeading1 xmlNode, Document2004 document) throws Exception {
        List<XmlNode> childrens = xmlNode.getXmlNodes();
        document.addEle(Heading1.with(xmlNode.getValue()).create().widthSerial(xmlNode.getIndex()));
        addChild(childrens,xmlNode,document);
    }
}
